//using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System;
using UnityEngine;

namespace QPDefine
{
    public class CalliOS
    {

        //#if UNITY_IPHONE
        //        [DllImport("__Internal")]
        //        private static extern void _iosOpenPhotoLibrary();

        //        [DllImport("__Internal")]
        //        private static extern void _iosUnityOpenPhoto(string path,int scale,int wh);    

        //		[DllImport ("__Internal")]
        //		private static extern string GetIphoneADID ();

        //		[DllImport ("__Internal")]
        //		private static extern bool isJailBreak1 ();

        //		[DllImport ("__Internal")]
        //		private static extern bool isJailBreak2 ();

        //		[DllImport ("__Internal")]
        //		private static extern bool isJailBreak3 ();

        //		[DllImport ("__Internal")]
        //		private static extern bool isJailBreak4 ();

        //		[DllImport ("__Internal")]
        //		private static extern bool isJailBreak5 ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosOpenPhotoAlbums ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosOpenCamera ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosOpenPhotoLibrary_allowsEditing ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosOpenPhotoAlbums_allowsEditing ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosOpenCamera_allowsEditing ();

        //		[DllImport ("__Internal")]
        //		private static extern void _iosSaveImageToPhotosAlbum (string readAddr);

        //		[DllImport ("__Internal")]
        //		private static extern void InitIAPManager ();
        //		//初始化

        //		[DllImport ("__Internal")]
        //        public static extern bool IsProductAvailable();
        //		//判断是否可以购买

        //		[DllImport ("__Internal")]
        //		private static extern void RequstProductInfo (string s);
        //		//获取商品信息

        //		[DllImport ("__Internal")]
        //		private static extern void BuyProduct (string s, string number);
        //		//购买商品

        //		[DllImport ("__Internal")]
        //		private static extern void BuyOk (string s); 

        //        //拷贝到系统剪切板
        //        [DllImport ("__Internal")]
        //        private static extern void _copyTextToClipboard(string text);

        //        //硬盘总大小
        //        [DllImport("__Internal")]
        //        private static extern string totalDiskSpace();

        //        //已用空间str
        //        [DllImport("__Internal")]
        //        private static extern string haveUseDiskSpace();

        //        //硬盘剩余空间str
        //        [DllImport("__Internal")]
        //        private static extern string freeDiskSpace();  


        //#endif

        //        public static void AppInitIAPManager ()
        //		{
        //#if UNITY_IPHONE
        //				InitIAPManager ();
        //#endif
        //		}

        //		/// <summary>
        //		/// 打开照片
        //		/// </summary>
        //		/// <param name="allowsEditing"></param>
        //		public static void iosOpenPhotoLibrary (bool allowsEditing = true)
        //		{
        //#if UNITY_IPHONE
        //			if (allowsEditing)
        //				_iosOpenPhotoLibrary_allowsEditing ();
        //			else
        //				_iosOpenPhotoLibrary ();
        //#endif
        //		}

        //		/// <summary>
        //		/// 打开相册
        //		/// </summary>
        //		/// <param name="allowsEditing"></param>
        //		public static void iosOpenPhotoAlbums (bool allowsEditing = true)
        //		{
        //#if UNITY_IPHONE
        //			if (allowsEditing)
        //				_iosOpenPhotoAlbums_allowsEditing ();
        //			else
        //				_iosOpenPhotoAlbums ();
        //#endif
        //		}

        //		/// <summary>
        //		/// 打开相机
        //		/// </summary>
        //		/// <param name="allowsEditing"></param>
        //		public static void iosOpenCamera (bool allowsEditing = true)
        //		{
        //#if UNITY_IPHONE
        //			if (allowsEditing)
        //				_iosOpenCamera_allowsEditing ();
        //			else
        //				_iosOpenCamera ();
        //#endif
        //		}

        //		/// <summary>
        //		/// 保存图片到相册
        //		/// </summary>
        //		/// <param name="readAddr"></param>
        //		public static void iosSaveImageToPhotosAlbum (string readAddr)
        //		{
        //#if UNITY_IPHONE
        //			_iosSaveImageToPhotosAlbum (readAddr);
        //#endif
        //		}


        //		/// <summary>
        //		/// 打开手机相册
        //		/// </summary>
        //		public static void UnityGetXiangChe ()
        //		{
        //            string path = Application.persistentDataPath;
        //#if UNITY_ANDROID
        //                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //                AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //                jo.Call("TakePhoto", "takeSave",path);
        //#elif UNITY_IPHONE
        //                iosOpenPhotoAlbums();
        //#endif
        //        }

        //		/// <summary>
        //		/// 打开手机照相机
        //		/// </summary>
        //		public static void UnityGetXiangJi ()
        //        {
        //            string path = Application.persistentDataPath;
        //#if UNITY_ANDROID
        //                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //                AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //                jo.Call("TakePhoto", "takePhoto",path);
        //#elif UNITY_IPHONE
        //            iosOpenCamera();
        //#endif

        //        }




        //        /// <summary>
        //        /// 打开手机相册
        //        /// </summary>
        //        public static void UnityGetPhone()
        //        {
        //            string path = Application.persistentDataPath;
        //#if UNITY_ANDROID
        //                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //                AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //                jo.Call("TakePhoto", "getPhoto",path);
        //#elif UNITY_IPHONE
        //            _iosUnityOpenPhoto(path,0,0);
        //#endif
        //        }
        //        public static void GetPhonePicture(int scale, int wh)
        //        {
        //            string path = Application.persistentDataPath;
        //#if UNITY_ANDROID
        //                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //                AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //                jo.Call("iosUnityOpenPhoto",scale.ToString(),wh.ToString());
        //#elif UNITY_IPHONE
        //            _iosUnityOpenPhoto(path,scale,wh);
        //#endif
        //        }
        //        /// <summary>
        //        /// 打开手机照相机
        //        /// </summary>
        //        public static void UnityGetTake()
        //        {
        //            string path = Application.persistentDataPath;
        //#if UNITY_ANDROID
        //                AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //                AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //                jo.Call("TakePhoto", "getTake",path);
        //#elif UNITY_IPHONE
        //            iosOpenCamera();
        //#endif

        //        }



        //        public static void CopyTextToClipboard(string input)
        //        {
        //#if UNITY_ANDROID
        //            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //            AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //            jo.Call("CopyTextToClipboard", input);
        //#elif UNITY_IPHONE
        //            _copyTextToClipboard(input);
        //#endif
        //        }


        //		public static void ServerBuyOk (string id)
        //		{
        //#if UNITY_IPHONE
        //			BuyOk (id);
        //#endif
        //		}


        //		public static void IOSPay (string name, string number)
        //		{
        //#if UNITY_IPHONE
        //			BuyProduct (name, number);
        //#endif
        //		}



        //		public static void IOSRequstProductInfo (string str)
        //		{
        //#if UNITY_IPHONE
        //			RequstProductInfo (str);
        //#endif
        //		}
        //		//获取iphone唯一识别码
        //		public static string GetADID ()
        //		{
        //            string str = string.Empty;
        //#if UNITY_IPHONE
        //			str= GetIphoneADID ();
        //#endif
        //            return str;
        //        }

        //        public static  bool ProductAvailable()
        //        {
        //            bool bl=true;
        //#if UNITY_IPHONE
        //            bl = IsProductAvailable();
        //#endif
        //            return bl;
        //        }

        //        public static void SetNoBackupFlag(string path)
        //        {
        //#if UNITY_IPHONE
        //            UnityEngine.iOS.Device.SetNoBackupFlag(path);
        //#endif
        //        }


        //        public static bool JailBreak1()
        //        {
        //            bool bl = false;
        //#if UNITY_IPHONE
        //            bl = isJailBreak1();
        //#endif
        //            return bl;
        //        }

        //        public static bool JailBreak2()
        //        {
        //            bool bl = false;
        //#if UNITY_IPHONE
        //            bl = isJailBreak2();
        //#endif
        //            return bl;
        //        }

        //        public static bool JailBreak3()
        //        {
        //            bool bl = false;
        //#if UNITY_IPHONE
        //            bl = isJailBreak3();
        //#endif
        //            return bl;
        //        }

        //        public static bool JailBreak4()
        //        {
        //            bool bl = false;
        //#if UNITY_IPHONE
        //            bl = isJailBreak4();
        //#endif
        //            return bl;
        //        }

        //        public static bool JailBreak5()
        //        {
        //            bool bl = false;
        //#if UNITY_IPHONE
        //            bl = isJailBreak5();
        //#endif
        //            return bl;
        //        }

        //        public static string GetTotalDiskSpace()
        //        {
        //            string size = "0";
        //#if UNITY_ANDROID
        //            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //            AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //            size = jo.Call<string>("totalDiskSpace");  
        //#elif UNITY_IPHONE
        //            size = totalDiskSpace();
        //#endif
        //            return size;
        //        }
        //        public static string GetFreeDiskSpace()
        //        {
        //            string size = "0";
        //#if UNITY_ANDROID
        //            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //            AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //            size = jo.Call<string>("freeDiskSpace");  
        //#elif UNITY_IPHONE
        //            size = freeDiskSpace();
        //#endif
        //            return size;
        //        }
        //        public static string GetHaveUseDiskSpace()
        //        {
        //            string size = "0";
        //#if UNITY_ANDROID
        //            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        //            AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        //            size = jo.Call<string>("haveUseDiskSpace");  
        //#elif UNITY_IPHONE
        //            size = haveUseDiskSpace();
        //#endif
        //            return size;
        //        }
    }
}
